<template>
  <div class="user_box">
    <!-- 中间分隔 -->
    <div class="m_alert">
      <i class="el-icon-info"></i>
      <div class="m_text">
        共<span>{{ tableData.length }}</span
        >条数据
      </div>
    </div>

    <!-- table表单 -->
    <template>
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="type" label="操作类型" width="180">
        </el-table-column>
        <el-table-column prop="name" label="操作人" width="180">
        </el-table-column>
        <el-table-column prop="result" label="执行结果"> </el-table-column>
        <el-table-column prop="time" label="操作时间"> </el-table-column>
        <el-table-column prop="det" label="描述"> </el-table-column>
      </el-table>

      <!-- 分页导航 -->
      <footPage
        class="footpage"
        :total="total"
        :paginationPage="data.page"
        :paginationPagesize="data.pagesize"
        @pageChange="handleCurrentChange"
        @pageSizeChange="handleSizeChange"
      ></footPage>
      <!-- <div class="block">
        <el-pagination
          background
          :current-page="1"
          :page-sizes="[10, 20, 30, 50]"
          :page-size="100"
          :total="total"
          layout=" prev, pager, next, sizes, jumper"
        >
        </el-pagination>
      </div> -->
    </template>
  </div>
</template>

<script>
import footPage from '../components/page-tool.vue'
export default {
  components: {
    footPage
  },
  data () {
    return {
      tableData: [
        {
          type: 'CN',
          name: '王小虎',
          result: '管方己更义列开高该人战须外管产必亲才须入样克开算出员没查。',
          time: '2023-06-05 11:08:48,',
          det: '断验们今'
        }, {
          type: 'CN',
          name: '王小虎',
          result: '管方己更义列开高该人战须外管产必亲才须入样克开算出员没查。',
          time: '2023-06-05 11:08:48,',
          det: '断验们今'
        }, {
          type: 'CN',
          name: '王小虎',
          result: '管方己更义列开高该人战须外管产必亲才须入样克开算出员没查。',
          time: '2023-06-05 11:08:48,',
          det: '断验们今'
        }, {
          type: 'CN',
          name: '王小虎',
          result: '管方己更义列开高该人战须外管产必亲才须入样克开算出员没查。',
          time: '2023-06-05 11:08:48,',
          det: '断验们今'
        }, {
          type: 'CN',
          name: '王小虎',
          result: '管方己更义列开高该人战须外管产必亲才须入样克开算出员没查。',
          time: '2023-06-05 11:08:48,',
          det: '断验们今'
        }, {
          type: 'CN',
          name: '王小虎',
          result: '管方己更义列开高该人战须外管产必亲才须入样克开算出员没查。',
          time: '2023-06-05 11:08:48,',
          det: '断验们今'
        },
        {
          type: 'CN',
          name: '王小虎',
          result: '管方己更义列开高该人战须外管产必亲才须入样克开算出员没查。',
          time: '2023-06-05 11:08:48,',
          det: '断验们今'
        },
        {
          type: 'CN',
          name: '王小虎',
          result: '管方己更义列开高该人战须外管产必亲才须入样克开算出员没查。',
          time: '2023-06-05 11:08:48,',
          det: '断验们今'
        },
        {
          type: 'CN',
          name: '王小虎',
          result: '管方己更义列开高该人战须外管产必亲才须入样克开算出员没查。',
          time: '2023-06-05 11:08:48,',
          det: '断验们今'
        },
        {
          type: 'CN',
          name: '王小虎',
          result: '管方己更义列开高该人战须外管产必亲才须入样克开算出员没查。',
          time: '2023-06-05 11:08:48,',
          det: '断验们今'
        }
      ],
      defaultProps: {
        children: 'children',
        label: 'label'
      },
      formLabelWidth: '100px',
      total: null,
      data: {
        page: 1,
        pagesize: 10
      }
    }
  },

  async created () {
    this.total = this.tableData.length
  },

  methods: {

    handleSizeChange (val) {
      this.data.pagesize = val
      this.renderList()
      console.log(`每页 ${val} 条`)
    },
    handleCurrentChange (val) {
      this.data.page = val
      this.renderList()
      console.log(`当前页: ${val}`)
    }
  }
}
</script>

<style scoped lang="less">
.user_box {
  width: 1178px;
  // height: 417.5px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  border: 1px solid #ebeef5;
  background-color: #fff;
  color: #303133;
  transition: 0.3s;
  border-radius: 4px;
  overflow: hidden;
  margin: 20px;
  padding: 20px;
}
.footpage {
  float: right;
}
.addBtn {
  float: right;
  margin-left: 10px;
  color: #fff;
  background-color: #67c23a;
  border-color: #67c23a;
  border: 1px solid #dcdfe6;
  font-weight: 500;
}
.m_alert {
  display: flex;
  background-color: #f4f4f5;
  color: #909399;
  width: 100%;
  padding: 8px 16px;
  margin: 0;
  border-radius: 4px;
  color: #909399;
  i {
    display: inline-block;
    font-size: 16px;
    width: 16px;
    line-height: 1;
    margin-right: 5px;
  }
  .m-text {
    font-size: 13px;
    line-height: 18px;
  }
}
.el-pagination {
  margin-top: 20px;
  text-align: right;
}

.edit1 {
  color: #409eff;
  background: #ecf5ff;
  border-color: #b3d8ff;
  &:hover {
    background-color: #409eff;
    color: #fff;
  }
}
.edit2 {
  color: #f56c6c;
  background: #fef0f0;
  border-color: #fbc4c4;
  &:hover {
    background-color: #f56c6c;
    color: #fff;
  }
}
</style>
